#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "ADC.h"

uint16_t ADC_Num;
float ADC_Volt;

int main(void)
{
	/*模块初始化*/
	OLED_Init();		//OLED初始化
	Adc_Init();   		//ADC初始化
	/*OLED显示*/
	OLED_ShowString(1, 1, "ADC_Num:");	//1行1列显示字符串ADCNum
	OLED_ShowString(2, 1, "voltage:0.00V");	//1行1列显示字符串ADCNum
	
	while (1)
	{
		ADC_Num = Adc_GetData();
		OLED_ShowNum(1,9,ADC_Num,5);
		
		ADC_Volt = (float)ADC_Num /4095 * 3.3;
		OLED_ShowNum(2,9,ADC_Volt,1);
		OLED_ShowNum(2,11,(uint16_t)(ADC_Volt*100)% 100,2);
		Delay_ms(100);
	}
}
